<%@ page contentType="text/html; charset=utf-8"
	import="com.running.crm.model.SmsConfig"%>
<%
	SmsConfig sms = (SmsConfig) request.getAttribute("data");
%>
<html>
	<head>
		<script language="javascript">
function calculateSms(obj) {
	var maxLength = obj._dataLength;
	var s = "共"+obj.value.length+"字";
	if (obj.value.length <= 70) {
		s += "1"+"条短信";
	} else {
		if (obj.value.length%70 > 0) {
			s += (parseInt(obj.value.length/70) + 1)+"条短信";
		} else {
			s += (parseInt(obj.value.length/70))+"条短信";
		}
	}
	s += "/最大可为"+maxLength+"字";
	document.getElementById("smsTip").innerHTML = s;
}

function window::onload() {
	calculateSms(document.oForm.smsContent);
}
</script>
	</head>
	<body>
		<form name="oForm" onsubmit="return ValidateForm(this)" method="POST"
			action="smsConfig.do?method=saveEdit">
			<input type="hidden" value="<%=sms.getSmsSid()%>" name="smsSid" />
			<table id="FormTable">
				<CAPTION>
					修改短信
				</CAPTION>
				<tr>
					<td>
						<font class="FieldItem">短信标题<font class="NotNull">(*必填项)</font>
						</font>
						<br />
						<input type="text" name="smsSubject" _dataType="string"
							_cnName="短信标题" _dataEmpty="false" _dataLength="128"
							value="<%=sms.getSmsSubject()%>" />
					</td>
				</tr>
				<tr>
					<td>
						<font class="FieldItem">短信内容<font class="NotNull">(*必填项)<span
								id="smsTip"></span>
						</font>
						</font>
						<br />
						<textarea name="smsContent" _dataType="string" _cnName="短信内容"
							_dataEmpty="false" _dataLength="255"
							onkeyup="calculateSms(this)" onblur="calculateSms(this)"><%=sms.getSmsContent()%></textarea>
					</td>
				</tr>
				<tr>
					<td>
					<font class="FieldItem" style="vertical-align: middle">
						<label for="oDefaultIncoming"
								style="cursor: hand;">
								<input type="checkbox" name="defaultIncomingcallSms" value="Y"
									class="DefaultCheckBox" id="oDefaultIncoming"
									<%if (sms.getDefaultIncomingcallSms().equals(SmsConfig.SMS_STATUS_DEFAULT)) out.print("checked");%> />
									来电短信
							</label> 
							</font>
							<font class="FieldItem" style="vertical-align: middle">
							<label for="oDefaultDeelectrifying" style="cursor: hand;">
								<input type="checkbox" name="defaultDeelectrifyingSms" value="Y"
									class="DefaultCheckBox" id="oDefaultDeelectrifying"
									<%if (sms.getDefaultDeelectrifyingSms().equals(SmsConfig.SMS_STATUS_DEFAULT)) out.print("checked");%> />
								去电短信
								
							</label> 
							</font>
					</td>
				</tr>
				<tr>
					<td>
						<HR />
					</td>
				</tr>
				<tr>
					<td>
						<input type="submit" name="btnSubmit" value=" 保 存 "
							class="DefaultButton" />
						&nbsp;
						<input type="button" name="btnCancel" value=" 取 消 "
							class="DefaultBtnCancel" />
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>